<!--
Apple's config is different compared to the common OAuth provider implemented
before, this makes the generalized `auth_provider_settings` not work well so it
requires a custom partial
-->
<fieldset class="config-authentication-form">
  <div
    class="crayons-notice crayons-notice--warning auth-warning <%= authentication_provider_enabled?(provider) ? "hidden" : "" %>" aria-live="polite">
      <strong>Note:</strong> This authentication provider will <strong>not</strong> be enabled if the key or secret are missing. Please make sure that you enter your key and secret correctly.
  </div>
  <div class="crayons-field">
    <%= admin_config_label :apple_client_id %>
    <p class="crayons-field__description">
      <%= Constants::Settings::Authentication.details[:apple_client_id][:description] %>
    </p>
    <%= f.text_field :apple_client_id,
                     class: "crayons-textfield",
                     value: Settings::Authentication.apple_client_id,
                     placeholder: Constants::Settings::Authentication.details[:apple_client_id][:placeholder] %>
  </div>
  <div class="crayons-field">
    <%= admin_config_label :apple_key_id %>
    <p class="crayons-field__description">
      <%= Constants::Settings::Authentication.details[:apple_key_id][:description] %>
    <p>
    <%= f.text_field :apple_key_id,
                     class: "crayons-textfield",
                     value: Settings::Authentication.apple_key_id,
                     placeholder: Constants::Settings::Authentication.details[:apple_key_id][:placeholder] %>
  </div>
  <div class="crayons-field">
    <%= admin_config_label :apple_pem %>
    <p class="crayons-field__description">
      <%= Constants::Settings::Authentication.details[:apple_pem][:description] %>
    <p>
    <%= f.text_area :apple_pem,
                    class: "crayons-textfield",
                    value: Settings::Authentication.apple_pem,
                    placeholder: Constants::Settings::Authentication.details[:apple_pem][:placeholder],
                    style: "height: 175px;" %>
  </div>
  <div class="crayons-field">
    <%= admin_config_label :apple_team_id %>
    <p class="crayons-field__description">
      <%= Constants::Settings::Authentication.details[:apple_team_id][:description] %>
    <p>
    <%= f.text_field :apple_team_id,
                     class: "crayons-textfield",
                     value: Settings::Authentication.apple_team_id,
                     placeholder: Constants::Settings::Authentication.details[:apple_team_id][:placeholder] %>
  </div>
  <div class="crayons-btn-actions">
    <% if authentication_provider_enabled?(provider) %>
      <button
        class="crayons-btn crayons-btn--danger"
        data-action="click->config#activateAuthProviderModal"
        data-tooltip="<%= tooltip_text_email_or_auth_provider_btns %>"
        data-provider-name="<%= provider.provider_name %>"
        data-provider-official-name="<%= provider.official_name %>"
        <%= disabled_attr_on_auth_provider_enable_btn %>>
        Disable
      </button>
      <button
        class="crayons-btn crayons-btn--secondary"
        data-provider-name="<%= provider.provider_name %>"
        data-action="click->config#hideAuthProviderSettings">
        Close
      </button>
    <% else %>
      <button
        class="crayons-btn crayons-btn--secondary"
        data-provider-name="<%= provider.provider_name %>"
        data-action="click->config#disableAuthProvider">
        Undo
      </button>
    <% end %>
  </div>
</fieldset>
